<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img class="banner-img" :src="bannerImg" alt="">
      <div class="banner-info">
        <div class="banner-title">{{sightName}}</div>
        <div class="banner-number">
          <span class="iconfont icon-shuffling-banner-fill banner-icon"></span>
          18
        </div>
      </div>
    </div>
    <FadeAnimation>
      <Gallary :imgs="gallaryImgs" v-show="isImgs" @close="close" />
    </FadeAnimation>
  </div>
</template>

<script>
import Gallary from '@/components/gallary/Gallary.vue'
import FadeAnimation from '@/components/fade/FadeAnimation'
export default {
  props: {
    bannerImg: {
      type: String,
      default: ''
    },
    sightName: {
      type: String,
      default: ''
    },
    gallaryImgs: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  data () {
    return {
      isImgs: false
    }
  },
  components: {
    Gallary,
    FadeAnimation
  },
  methods: {
    handleBannerClick () {
      this.isImgs = true
      this.$emit('closeIcon')
    },
    close () {
      this.isImgs = false
      this.$emit('closeIcon')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .banner
   position relative
   overflow hidden
   height 0
   padding-bottom 55%
   .banner-img
    width 100%
   .banner-info
    display flex
    position absolute
    left 0
    right 0
    bottom 0
    line-height .6rem
    background-image -webkit-linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,.8))
    .banner-title
     flex 1
     font-size .28rem
     padding 0 .2rem
     color #fff
    .banner-number
     margin-top .14rem
     padding 0 .4rem
     height .32rem
     line-height .32rem
     border-radius .2rem
     color #fff
     background rgba(0,0,0,.8)
     .banner-icon
      font-size .24rem
</style>
